//
// Created by Semir on 2020/6/6.
//

#include <iostream>
#include <set>
#include <vector>

using namespace std;

void FindNumsAppearOnce(vector<int> data, int* num1, int *num2) {
    int res = 0;
    for (auto i : data) {
        res ^= i;
    }
    int index = 1;
    while ((index & res) == 0) {
        index = index << 1;
    }
    int n1 = 0;
    int n2 = 0;
    for (auto i : data) {
        if ((index & i) == 0) {
            n1 ^= i;
        } else {
            n2 ^= i;
        }
    }
    *num1 = n1;
    *num2 = n2;
}

int main() {
    vector<int> data = {1, 3, 1, 3, 4, 5, 5, 2, 4, 8};
    int *num1 = new int;
    int *num2 = new int;
    FindNumsAppearOnce(data, num1, num2);
    cout << *num1 << " " << *num2 << endl;
    return 0;
}